package com.tianji.learning.controller;


import com.tianji.api.dto.leanring.LearningLessonDTO;
import com.tianji.common.domain.dto.PageDTO;
import com.tianji.common.domain.query.PageQuery;
import com.tianji.learning.domain.dto.LearningPlanDTO;
import com.tianji.learning.domain.dto.LearningRecordFormDTO;
import com.tianji.learning.domain.po.LearningRecord;
import com.tianji.learning.domain.vo.LearningLessonVO;
import com.tianji.learning.domain.vo.LearningPlanPageVO;
import com.tianji.learning.service.ILearningLessonService;
import com.tianji.learning.service.ILearningRecordService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 学习记录表 前端控制器
 * </p>
 *
 * @author dayu
 * @since 2024-08-22
 */
@RestController
@RequestMapping("/learning-records")
public class LearningRecordController {

  @Autowired
  private ILearningRecordService recordService;
  @ApiOperation("查询指定课程的学习记录")
  @GetMapping("/course/{courseId}")
  public LearningLessonDTO queryLearningRecordByCourse(
          @ApiParam(value = "课程id", example = "2") @PathVariable("courseId") Long courseId){
    return recordService.queryLearningRecordByCourse(courseId);
  }
  @ApiOperation("提交学习记录")
  @PostMapping
  public void addLearningRecord(@RequestBody LearningRecordFormDTO formDTO){
    recordService.addLearningRecord(formDTO);
  }

}
